/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package atualizacoes;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Douglas
 */
@Entity
@Table(name = "revisoes", catalog = "", schema = "")
@NamedQueries({
    @NamedQuery(name = "Revisoes.findAll", query = "SELECT r FROM Revisoes r"),
    @NamedQuery(name = "Revisoes.findByCodRevisao", query = "SELECT r FROM Revisoes r WHERE r.codRevisao = :codRevisao"),
    @NamedQuery(name = "Revisoes.findByRevisao", query = "SELECT r FROM Revisoes r WHERE r.revisao = :revisao")})
public class Revisoes implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "cod_revisao")
    private Integer codRevisao;
    @Basic(optional = false)
    @Column(name = "revisao")
    private String revisao;
    @OneToMany(mappedBy = "codRevisao")
    private List<Atualizacoes> atualizacoesList;

    public Revisoes() {
    }

    public Revisoes(Integer codRevisao) {
        this.codRevisao = codRevisao;
    }

    public Revisoes(Integer codRevisao, String revisao) {
        this.codRevisao = codRevisao;
        this.revisao = revisao;
    }

    public Integer getCodRevisao() {
        return codRevisao;
    }

    public void setCodRevisao(Integer codRevisao) {
        Integer oldCodRevisao = this.codRevisao;
        this.codRevisao = codRevisao;
        changeSupport.firePropertyChange("codRevisao", oldCodRevisao, codRevisao);
    }

    public String getRevisao() {
        return revisao;
    }

    public void setRevisao(String revisao) {
        String oldRevisao = this.revisao;
        this.revisao = revisao;
        changeSupport.firePropertyChange("revisao", oldRevisao, revisao);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codRevisao != null ? codRevisao.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Revisoes)) {
            return false;
        }
        Revisoes other = (Revisoes) object;
        if ((this.codRevisao == null && other.codRevisao != null) || (this.codRevisao != null && !this.codRevisao.equals(other.codRevisao))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "atualizacoes.Revisoes[ codRevisao=" + codRevisao + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
